<template>
  <div id="goods-info">
    <div class="info-desc">
      <div class="start"></div>
      <div class="desc"></div>
      <div class="end"></div>
    </div>
    <div class="info-key">
      <!-- {{detailInfo.detailImage[0] :key=""}} -->
    </div>
    <div class="info-list">
      <img
        v-for="(item, index) in detailInfo.detailImage[0].list"
        :key="index"
        :src="item"
        @load="imgLoad"
        alt=""
      />
    </div>
  </div>
</template>

<script>
import bus from "../../../router/eventBus";
export default {
  props: {
    detailInfo: {
      type: Object,
    },
  },
  data() {
    return {
      counter: 0,
      imagesLength: 0,
    };
  },
  methods: {
    imgLoad() {
      if (++this.counter === this.imagesLength) {
        this.$emit("imageLoad");
        bus.$emit("detailImageLoad", true);
      }
    },
  },
  watch: {
    detailInfo() {
      this.imagesLength = this.detailInfo.detailImage[0].list.length;
    },
  },
};
</script>

<style lang="less" scoped>
#goods-info {
  .info-list {
    width: 100%;
    img {
      width: 100%;
    }
  }
}
</style>